#include "mainedit.h"
#include <QDebug>

MainEdit::MainEdit(QWidget *parent):
    QLineEdit(parent)
{
    // 初始化鼠标按下状态
    isMousePressed = false;
}

void MainEdit::mousePressEvent(QMouseEvent *event)
{
    if (event->button() == Qt::LeftButton) {
        // 处理左键单击
        isMousePressed = true;
    }
}

void MainEdit::mouseReleaseEvent(QMouseEvent *event) {
    if (event->button() == Qt::LeftButton) {
        // 检查鼠标释放时是否还在文本框内
        if (isMousePressed && rect().contains(event->pos())) {
            emit Slots_Click();
        }
        // 重置鼠标按下状态
        isMousePressed = false;
    }
}
